diff --git a/meson.build b/meson.build
index 0c0a5ae..b3e66a1 100644
--- a/meson.build
+++ b/meson.build
@@ -24,7 +24,11 @@ pygobject_dep = dependency('pygobject-3.0', fallback: ['pygobject', 'pygobject_d
 
 pymod = import('python')
 python = pymod.find_installation(get_option('python'))
-python_dep = python.dependency(required : true)
+if get_option('python').endswith('2')
+  python_dep = python.dependency(required : true)
+else
+  python_dep = dependency('python3-embed', required : true)
+endif
 
 python_abi_flags = python.get_variable('ABIFLAGS', '')
 pylib_loc = get_option('libpython-dir')
